<?php
/*
	Author: coooold@newsmth
	Date:	2013.08.14
	Des:	For any purpose!
*/
define('_MONGODB_HOST', "YOUR MONGODB HOST!!!!!!!!");
include('MongoBean.php');

//例子，博客模型
class Blog extends MongoBean{
	protected static $dbName = 'mongo';
	protected static $collectionName = 'blog';
	
	public $title;
	public $author;
}

//清空数据
MongoConn::remove('mongo','blog');

//创建博客
$b = Blog::create();
$b->title = '一本书';
$b->author = '张三';
$b->save();

//查找所有博客
print_r(Blog::find());

//查找一条博客
$b = Blog::findOne();
$b->title = 'aaa'.rand();
$b->save();

//查找所有博客
print_r(Blog::find());

//查找一条博客
$b = Blog::findOne();
$b->remove();
$b->save();